#ifndef XLSXPROCTASK_H
#define XLSXPROCTASK_H

#include "procthread.h"
#include "public.h"
#include "xlsxdocument.h"
#include "xlsxworkbook.h"
#include "xlsxworksheet.h"
#include <QDir>
#include <QEventLoop>
#include <QFile>
#include <QFileInfo>
#include <QList>
#include <QObject>
#include <QSet>
#include <QThread>
#include <QThreadPool>
#include <QTimer>
#include <QtDebug>

using namespace QXlsx;
class xlsxProcTask : public QObject {
  Q_OBJECT
public:
  xlsxProcTask();
  ~xlsxProcTask();
public slots:
  void exportXlsx();
  void setWorkParam(const xlsxParam_t &);
  QString errrorString();
signals:
  void erroInfo(QString);
  void workFinished();
  void importFinished();
  void exportFinished();
  void procProcss(double, qint64 min, qint64 max); /* 处理进度 */

private:
  bool writeXlsx(const QString &sql, const QStringList &head,
                 const QString &xlsxName);

  void removeListSame(QStringList *list);
  void procxlsx(const int &row, const int &coulmn, const QString &savePath);

private:
  xlsxParam_t xlsxParam;
  QString errString;
  QThreadPool tasks;
  procThread workThread;
  Document *xlsx;
  QString xlstName;
};

#endif // XLSXPROCTASK_H
